Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
require-one
Advanced tools
Load the first package found from the given array.
Method | Installation |
---|---|
npm | npm install require-one --save |
component | component install robloach/require-one |
Composer | composer require require-one |
Bower | bower install require-one |
This works across CommonJS/node, AMD and with global variables for the browser.
This is an example of loading either jQuery, Zepto, or Cheerio with a CommonJS module loader, like Node.js.
var $ = requireOne('jquery', 'zepto', 'cheerio');
// => jQuery, Zepto or Cheerio, depending on which one is available.
This is an example of loading either jQuery, Zepto, or Cheerio with an AMD module loader, like Require.js.
require(['require-one'], function(requireOne) {
// Retrieve the first package that is available.
var $ = requireOne('jquery', 'zepto', 'cheerio');
// => jQuery, Zepto or Cheerio, depending on which one is available.
// ...
});
This is an example of loading either jQuery, Zepto, or Cheerio without a module loader, i.e. with the browser's global variables.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="path/to/require-one.js"></script>
<script>
var $ = requireOne('jquery', 'jQuery', 'zepto', 'Zepto', 'cheerio');
// => jQuery, Zepto or Cheerio, depending on which one is available.
</script>
</head>
<body>
<h1>My Sample Project</h1>
</body>
</html>
[1.0.3] - 2016-12-24
FAQs
Require the first found package from an array.
The npm package require-one receives a total of 2,889 weekly downloads. As such, require-one popularity was classified as popular.
We found that require-one demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.